<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>Pulse-density modulation</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/Pulse-density_modulation"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/ext.math.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Pulse-density_modulation rootpage-Pulse-density_modulation skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">Pulse-density modulation</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr">
<style data-mw-deduplicate="TemplateStyles:r1129693374">
/* start https://en.wikipedia.org/ */
.mw-parser-output .hlist dl,.mw-parser-output .hlist ol,.mw-parser-output .hlist ul{margin:0;padding:0}.mw-parser-output .hlist dd,.mw-parser-output .hlist dt,.mw-parser-output .hlist li{margin:0;display:inline}.mw-parser-output .hlist.inline,.mw-parser-output .hlist.inline dl,.mw-parser-output .hlist.inline ol,.mw-parser-output .hlist.inline ul,.mw-parser-output .hlist dl dl,.mw-parser-output .hlist dl ol,.mw-parser-output .hlist dl ul,.mw-parser-output .hlist ol dl,.mw-parser-output .hlist ol ol,.mw-parser-output .hlist ol ul,.mw-parser-output .hlist ul dl,.mw-parser-output .hlist ul ol,.mw-parser-output .hlist ul ul{display:inline}.mw-parser-output .hlist .mw-empty-li{display:none}.mw-parser-output .hlist dt::after{content:": "}.mw-parser-output .hlist dd::after,.mw-parser-output .hlist li::after{content:" · ";font-weight:bold}.mw-parser-output .hlist dd:last-child::after,.mw-parser-output .hlist dt:last-child::after,.mw-parser-output .hlist li:last-child::after{content:none}.mw-parser-output .hlist dd dd:first-child::before,.mw-parser-output .hlist dd dt:first-child::before,.mw-parser-output .hlist dd li:first-child::before,.mw-parser-output .hlist dt dd:first-child::before,.mw-parser-output .hlist dt dt:first-child::before,.mw-parser-output .hlist dt li:first-child::before,.mw-parser-output .hlist li dd:first-child::before,.mw-parser-output .hlist li dt:first-child::before,.mw-parser-output .hlist li li:first-child::before{content:" (";font-weight:normal}.mw-parser-output .hlist dd dd:last-child::after,.mw-parser-output .hlist dd dt:last-child::after,.mw-parser-output .hlist dd li:last-child::after,.mw-parser-output .hlist dt dd:last-child::after,.mw-parser-output .hlist dt dt:last-child::after,.mw-parser-output .hlist dt li:last-child::after,.mw-parser-output .hlist li dd:last-child::after,.mw-parser-output .hlist li dt:last-child::after,.mw-parser-output .hlist li li:last-child::after{content:")";font-weight:normal}.mw-parser-output .hlist ol{counter-reset:listitem}.mw-parser-output .hlist ol>li{counter-increment:listitem}.mw-parser-output .hlist ol>li::before{content:" "counter(listitem)"\a0 "}.mw-parser-output .hlist dd ol>li:first-child::before,.mw-parser-output .hlist dt ol>li:first-child::before,.mw-parser-output .hlist li ol>li:first-child::before{content:" ("counter(listitem)"\a0 "}
/* end https://en.wikipedia.org/ */
</style><style data-mw-deduplicate="TemplateStyles:r1246091330">
/* start https://en.wikipedia.org/ */
.mw-parser-output .sidebar{width:22em;float:right;clear:right;margin:0.5em 0 1em 1em;background:var(--background-color-neutral-subtle,#f8f9fa);border:1px solid var(--border-color-base,#a2a9b1);padding:0.2em;text-align:center;line-height:1.4em;font-size:88%;border-collapse:collapse;display:table}body.skin-minerva .mw-parser-output .sidebar{display:table!important;float:right!important;margin:0.5em 0 1em 1em!important}.mw-parser-output .sidebar-subgroup{width:100%;margin:0;border-spacing:0}.mw-parser-output .sidebar-left{float:left;clear:left;margin:0.5em 1em 1em 0}.mw-parser-output .sidebar-none{float:none;clear:both;margin:0.5em 1em 1em 0}.mw-parser-output .sidebar-outer-title{padding:0 0.4em 0.2em;font-size:125%;line-height:1.2em;font-weight:bold}.mw-parser-output .sidebar-top-image{padding:0.4em}.mw-parser-output .sidebar-top-caption,.mw-parser-output .sidebar-pretitle-with-top-image,.mw-parser-output .sidebar-caption{padding:0.2em 0.4em 0;line-height:1.2em}.mw-parser-output .sidebar-pretitle{padding:0.4em 0.4em 0;line-height:1.2em}.mw-parser-output .sidebar-title,.mw-parser-output .sidebar-title-with-pretitle{padding:0.2em 0.8em;font-size:145%;line-height:1.2em}.mw-parser-output .sidebar-title-with-pretitle{padding:0.1em 0.4em}.mw-parser-output .sidebar-image{padding:0.2em 0.4em 0.4em}.mw-parser-output .sidebar-heading{padding:0.1em 0.4em}.mw-parser-output .sidebar-content{padding:0 0.5em 0.4em}.mw-parser-output .sidebar-content-with-subgroup{padding:0.1em 0.4em 0.2em}.mw-parser-output .sidebar-above,.mw-parser-output .sidebar-below{padding:0.3em 0.8em;font-weight:bold}.mw-parser-output .sidebar-collapse .sidebar-above,.mw-parser-output .sidebar-collapse .sidebar-below{border-top:1px solid #aaa;border-bottom:1px solid #aaa}.mw-parser-output .sidebar-navbar{text-align:right;font-size:115%;padding:0 0.4em 0.4em}.mw-parser-output .sidebar-list-title{padding:0 0.4em;text-align:left;font-weight:bold;line-height:1.6em;font-size:105%}.mw-parser-output .sidebar-list-title-c{padding:0 0.4em;text-align:center;margin:0 3.3em}@media(max-width:640px){body.mediawiki .mw-parser-output .sidebar{width:100%!important;clear:both;float:none!important;margin-left:0!important;margin-right:0!important}}body.skin--responsive .mw-parser-output .sidebar a>img{max-width:none!important}@media screen{html.skin-theme-clientpref-night .mw-parser-output .sidebar:not(.notheme) .sidebar-list-title,html.skin-theme-clientpref-night .mw-parser-output .sidebar:not(.notheme) .sidebar-title-with-pretitle{background:transparent!important}html.skin-theme-clientpref-night .mw-parser-output .sidebar:not(.notheme) .sidebar-title-with-pretitle a{color:var(--color-progressive)!important}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .sidebar:not(.notheme) .sidebar-list-title,html.skin-theme-clientpref-os .mw-parser-output .sidebar:not(.notheme) .sidebar-title-with-pretitle{background:transparent!important}html.skin-theme-clientpref-os .mw-parser-output .sidebar:not(.notheme) .sidebar-title-with-pretitle a{color:var(--color-progressive)!important}}@media print{body.ns-0 .mw-parser-output .sidebar{display:none!important}}
/* end https://en.wikipedia.org/ */
</style><table class="sidebar nomobile nowraplinks skin-invert"><tbody><tr><th class="sidebar-title" style="background-color: #bdb"><a href="Passband" title="Passband">Passband</a> <a href="Signal_modulation" title="Signal modulation">modulation</a></th></tr><tr><td class="sidebar-image"><span typeof="mw:File"></span></td></tr><tr><th class="sidebar-heading" style="background-color: #cfc;">
<a href="Signal_modulation#Analog_modulation_methods" title="Signal modulation">Analog modulation</a></th></tr><tr><td class="sidebar-content hlist" style="color: black;">
<ul><li><a href="Amplitude_modulation" title="Amplitude modulation">AM</a>
<ul><li><a href="Space_modulation" title="Space modulation">SM</a></li>
<li><a href="Single-sideband_modulation" title="Single-sideband modulation">SSB</a></li></ul></li>
<li><a href="Angle_modulation" title="Angle modulation">Angle modulation</a>
<ul><li><a href="Frequency_modulation" title="Frequency modulation">FM</a></li>
<li><a href="Phase_modulation" title="Phase modulation">PM</a></li></ul></li>
<li><a href="Quadrature_amplitude_modulation" title="Quadrature amplitude modulation">QAM</a></li></ul></td>
</tr><tr><th class="sidebar-heading" style="background-color: #cfc;">
<a href="Signal_modulation#Digital_modulation_methods" title="Signal modulation">Digital modulation</a></th></tr><tr><td class="sidebar-content hlist" style="color: black;">
<ul><li><a href="Amplitude-shift_keying" title="Amplitude-shift keying">ASK</a></li>
<li><a href="Amplitude_and_phase-shift_keying" title="Amplitude and phase-shift keying">APSK</a></li>
<li><a href="Continuous_phase_modulation" title="Continuous phase modulation">CPM</a></li>
<li><a href="Frequency-shift_keying" title="Frequency-shift keying">FSK</a></li>
<li><a href="Multiple_frequency-shift_keying" title="Multiple frequency-shift keying">MFSK</a></li>
<li><a href="Minimum-shift_keying" title="Minimum-shift keying">MSK</a></li>
<li><a href="On%E2%80%93off_keying" title="On–off keying">OOK</a></li>
<li><a href="Pulse-position_modulation" title="Pulse-position modulation">PPM</a></li>
<li><a href="Phase-shift_keying" title="Phase-shift keying">PSK</a></li>
<li><a href="Quadrature_amplitude_modulation" title="Quadrature amplitude modulation">QAM</a></li>
<li><a href="Single-carrier_FDMA" title="Single-carrier FDMA">SC-FDE</a></li>
<li><a href="Trellis_coded_modulation" title="Trellis coded modulation">TCM</a></li>
<li><a href="TC-PAM" title="TC-PAM">TC-PAM</a></li>
<li><a href="Wavelet_modulation" title="Wavelet modulation">WDM</a></li></ul></td>
</tr><tr><th class="sidebar-heading" style="background-color: #cfc;">
<a href="Hierarchical_modulation" title="Hierarchical modulation">Hierarchical modulation</a></th></tr><tr><td class="sidebar-content hlist" style="color: black;">
<ul><li><a href="Quadrature_amplitude_modulation" title="Quadrature amplitude modulation">QAM</a></li>
<li><a href="Wavelet_modulation" title="Wavelet modulation">WDM</a></li></ul></td>
</tr><tr><th class="sidebar-heading" style="background-color: #cfc;">
<a href="Spread_spectrum" title="Spread spectrum">Spread spectrum</a></th></tr><tr><td class="sidebar-content hlist" style="color: black;">
<ul><li><a href="Chirp_spread_spectrum" title="Chirp spread spectrum">CSS</a></li>
<li><a href="Direct-sequence_spread_spectrum" title="Direct-sequence spread spectrum">DSSS</a></li>
<li><a href="Frequency-hopping_spread_spectrum" title="Frequency-hopping spread spectrum">FHSS</a></li>
<li><a href="Time-hopping" title="Time-hopping">THSS</a></li></ul></td>
</tr><tr><th class="sidebar-heading" style="background-color: #cfc;">
See also</th></tr><tr><td class="sidebar-content hlist" style="color: black;">
<ul><li>Capacity-approaching codes</li>
<li><a href="Demodulation" title="Demodulation">Demodulation</a></li>
<li><a href="Line_code" title="Line code">Line coding</a></li>
<li><a href="Modem" title="Modem">Modem</a></li>
<li><a href="Angle_modulation" title="Angle modulation">AnM</a></li>
<li><a href="Polar_modulation" title="Polar modulation">PoM</a></li>
<li><a href="Pulse-amplitude_modulation" title="Pulse-amplitude modulation">PAM</a></li>
<li><a href="Pulse-code_modulation" title="Pulse-code modulation">PCM</a></li>
<li><a href="Pulse-width_modulation" title="Pulse-width modulation">PWM</a></li>
<li><a href="Delta-sigma_modulation" title="Delta-sigma modulation">ΔΣM</a></li>
<li><a href="Orthogonal_frequency-division_multiplexing" title="Orthogonal frequency-division multiplexing">OFDM</a></li>
<li><a href="Frequency-division_multiplexing" title="Frequency-division multiplexing">FDM</a></li>
<li><a href="Multiplexing" title="Multiplexing">Multiplexing</a></li></ul></td>
</tr><tr><td class="sidebar-navbar"><style data-mw-deduplicate="TemplateStyles:r1239400231">
/* start https://en.wikipedia.org/ */
.mw-parser-output .navbar{display:inline;font-size:88%;font-weight:normal}.mw-parser-output .navbar-collapse{float:left;text-align:left}.mw-parser-output .navbar-boxtext{word-spacing:0}.mw-parser-output .navbar ul{display:inline-block;white-space:nowrap;line-height:inherit}.mw-parser-output .navbar-brackets::before{margin-right:-0.125em;content:"[ "}.mw-parser-output .navbar-brackets::after{margin-left:-0.125em;content:" ]"}.mw-parser-output .navbar li{word-spacing:-0.125em}.mw-parser-output .navbar a>span,.mw-parser-output .navbar a>abbr{text-decoration:inherit}.mw-parser-output .navbar-mini abbr{font-variant:small-caps;border-bottom:none;text-decoration:none;cursor:inherit}.mw-parser-output .navbar-ct-full{font-size:114%;margin:0 7em}.mw-parser-output .navbar-ct-mini{font-size:114%;margin:0 4em}html.skin-theme-clientpref-night .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}@media(prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}}@media print{.mw-parser-output .navbar{display:none!important}}
/* end https://en.wikipedia.org/ */
</style></td></tr></tbody></table>
<p><b>Pulse-density modulation</b> (<b>PDM</b>) is a form of <a href="Modulation" class="mw-redirect" title="Modulation">modulation</a> used to represent an <a href="Analog_signal" title="Analog signal">analog signal</a> with a <a href="Binary_signal" class="mw-redirect" title="Binary signal">binary signal</a>. In a PDM signal, specific <a href="Amplitude" title="Amplitude">amplitude</a> values are not encoded into codewords of pulses of different weight as they would be in <a href="Pulse-code_modulation" title="Pulse-code modulation">pulse-code modulation</a> (PCM); rather, the relative <a href="Density" title="Density">density</a> of the pulses corresponds to the analog signal's amplitude. The output of a <a href="1-bit_DAC" title="1-bit DAC">1-bit DAC</a> is the same as the PDM encoding of the signal.
</p>
<meta property="mw:PageProp/toc">
<div class="mw-heading mw-heading2"><h2 id="Description">Description</h2></div>
<p>In a pulse-density modulation <a href="Bitstream" title="Bitstream">bitstream</a>, a <b>1</b> corresponds to a pulse of positive polarity (+<i>A</i>), and a <b>0</b> corresponds to a pulse of negative polarity (−<i>A</i>). Mathematically, this can be represented as
</p>
<dl><dd><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle x[n]=-A(-1)^{a[n]},}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>x</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo stretchy="false">]</mo>
<mo>=</mo>
<mo>−<!-- − --></mo>
<mi>A</mi>
<mo stretchy="false">(</mo>
<mo>−<!-- − --></mo>
<mn>1</mn>
<msup>
<mo stretchy="false">)</mo>
<mrow class="MJX-TeXAtom-ORD">
<mi>a</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo stretchy="false">]</mo>
</mrow>
</msup>
<mo>,</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle x[n]=-A(-1)^{a[n]},}</annotation>
</semantics>
</math></span><img src="./d3054ff51907f3a148132066d52123e5a941d14d.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:19.097ex; height:3.343ex;" alt="{\displaystyle x[n]=-A(-1)^{a[n]},}" loading="lazy"></span></dd></dl>
<p>where <i>x</i>[<i>n</i>] is the bipolar bitstream (either −<i>A</i> or +<i>A</i>), and <i>a</i>[<i>n</i>] is the corresponding binary bitstream (either 0 or 1).
</p><p>A run consisting of all 1s would correspond to the maximum (positive) amplitude value, all 0s would correspond to the minimum (negative) amplitude value, and alternating 1s and 0s would correspond to a zero amplitude value. The continuous amplitude waveform is recovered by <a href="Low-pass_filter" title="Low-pass filter">low-pass filtering</a> the bipolar PDM bitstream.
</p>
<div class="mw-heading mw-heading2"><h2 id="Examples">Examples</h2></div>
<p>A single <a href="Periodic_function" title="Periodic function">period</a> of the <a href="Trigonometric_function" class="mw-redirect" title="Trigonometric function">trigonometric sine function</a>, <a href="Sample_(signal)" class="mw-redirect" title="Sample (signal)">sampled</a> 100 times and represented as a PDM bitstream, is:
</p><p>0101011011110111111111111111111111011111101101101010100100100000010000000000000000000001000010010101
</p>
<p>Two periods of a higher frequency sine wave would appear as:
</p><p>0101101111111111111101101010010000000000000100010011011101111111111111011010100100000000000000100101
</p>
<p>In pulse-<i>density</i> modulation, a high <i>density</i> of 1s occurs at the peaks of the sine wave, while a low <i>density</i> of 1s occurs at the troughs of the sine wave.
</p>
<div class="mw-heading mw-heading2"><h2 id="Analog-to-digital_conversion">Analog-to-digital conversion</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1236090951">
/* start https://en.wikipedia.org/ */
.mw-parser-output .hatnote{font-style:italic}.mw-parser-output div.hatnote{padding-left:1.6em;margin-bottom:0.5em}.mw-parser-output .hatnote i{font-style:normal}.mw-parser-output .hatnote+link+.hatnote{margin-top:-0.5em}@media print{body.ns-0 .mw-parser-output .hatnote{display:none!important}}
/* end https://en.wikipedia.org/ */
</style><div role="note" class="hatnote navigation-not-searchable">Main article: <a href="Delta-sigma_modulation" title="Delta-sigma modulation">Delta-sigma modulation</a></div>
<p>A PDM bitstream is <a href="Code" title="Code">encoded</a> from an analog signal through the process of a 1-bit <a href="Delta-sigma_modulation" title="Delta-sigma modulation">delta-sigma modulation</a>. This process uses a one-bit <a href="Quantizer" class="mw-redirect" title="Quantizer">quantizer</a> that produces either a 1 or 0 depending on the amplitude of the analog signal. A 1 or 0 corresponds to a signal that is all the way up or all the way down, respectively. Because in the real world, analog signals are rarely all the way in one direction, there is a quantization error, the difference between the 1 or 0 and the actual amplitude it represents. This error is fed back negatively in the ΔΣ process loop. In this way, every error successively influences every other quantization measurement and its error. This has the effect of <a href="Averaging" class="mw-redirect" title="Averaging">averaging</a> out the quantization error, while <a href="Noise_shaping" title="Noise shaping">noise shaping</a> it to <i>push</i> most of the quantization error into higher frequencies, which for audio signals would be <a href="Ultrasonic" class="mw-redirect" title="Ultrasonic">ultrasonic</a>.
</p>
<div class="mw-heading mw-heading2"><h2 id="PDM-to-PCM_conversion">PDM-to-PCM conversion</h2></div>
<p><a href="Downsampling_(signal_processing)" title="Downsampling (signal processing)">Decimation</a> is needed to convert a PDM signal from its very high sampling rate (e.g. some PDM mics may sample between 1 MHz to 3.25 MHz) to the much lower PCM sampling rate (which for audio may range between 16 kHz to 48 kHz).<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading2"><h2 id="Digital-to-analog_conversion">Digital-to-analog conversion</h2></div>
<p>The frequency components of interest, for example the audio frequency range, are much lower than the PDM's very high sampling rate. So, the process of <a href="Digital-to-analog_converter" title="Digital-to-analog converter">converting</a> a PDM signal into an analog one is simple: one only has to pass the PDM signal through a <a href="Low-pass_filter" title="Low-pass filter">low-pass filter</a>.<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup> Because the delta-sigma modulator had <i>pushed</i> most quantization noise into higher frequencies, low-pass filtering removes the high-frequency quantization noise while keeping the lower-frequency signal of interest.
</p>
<div class="mw-heading mw-heading2"><h2 id="Relationship_to_PWM">Relationship to PWM</h2></div>
<p><a href="Pulse-width_modulation" title="Pulse-width modulation">Pulse-width modulation</a> (PWM) is a special case of PDM where the switching frequency is fixed and all the pulses corresponding to one sample are contiguous in the digital signal. The method for demodulation to an analogue signal remains the same, but the representation of a 50% signal with a resolution of 8 bits, a PWM waveform will turn on for 128 clock cycles and then off for the remaining 128 cycles. With PDM and the same clock rate the signal would alternate between on and off every other cycle. The average obtained by a low-pass filter is 50% of the maximum signal level for both waveforms, but the PDM signal switches more often. For 100% or 0% level, they are the same, with the signal permanently on or off respectively.
</p>
<div class="mw-heading mw-heading2"><h2 id="Relationship_to_biology">Relationship to biology</h2></div>
<p>Notably, one of the ways animal nervous systems represent sensory and other information is through <a href="Rate_coding" class="mw-redirect" title="Rate coding">rate coding</a> whereby the magnitude of the signal is related to the rate of firing of the sensory neuron. In direct analogy, each neural event – called an action potential – represents one bit (pulse), with the rate of firing of the neuron representing the pulse density.
</p>
<div class="mw-heading mw-heading2"><h2 id="Algorithm">Algorithm</h2></div>
<p>The following digital model of pulse-density modulation can be obtained from a digital model of a 1st-order 1-bit <a href="Delta-sigma_modulator" class="mw-redirect" title="Delta-sigma modulator">delta-sigma modulator</a>. Consider a signal <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle x[n]}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>x</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo stretchy="false">]</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle x[n]}</annotation>
</semantics>
</math></span><img src="./864cbbefbdcb55af4d9390911de1bf70167c4a3d.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:4.018ex; height:2.843ex;" alt="{\displaystyle x[n]}" loading="lazy"></span> in the <a href="Discrete_time" class="mw-redirect" title="Discrete time">discrete time</a> domain as the input to a first-order delta-sigma modulator, with <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle y[n]}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>y</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo stretchy="false">]</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle y[n]}</annotation>
</semantics>
</math></span><img src="./305428e6d1fb59cd0163a7a96ace52292a262afa.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:3.844ex; height:2.843ex;" alt="{\displaystyle y[n]}" loading="lazy"></span> the output. In the <a href="Discrete_frequency" class="mw-redirect" title="Discrete frequency">discrete frequency</a> domain, where the <a href="Z-transform" title="Z-transform">Z-transform</a> has been applied to the amplitude time-series <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle x[n]}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>x</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo stretchy="false">]</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle x[n]}</annotation>
</semantics>
</math></span><img src="./864cbbefbdcb55af4d9390911de1bf70167c4a3d.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:4.018ex; height:2.843ex;" alt="{\displaystyle x[n]}" loading="lazy"></span> to yield <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle X(z)}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>X</mi>
<mo stretchy="false">(</mo>
<mi>z</mi>
<mo stretchy="false">)</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle X(z)}</annotation>
</semantics>
</math></span><img src="./727fb275ca22820bf91e526120c4939a1d38a2b0.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:4.877ex; height:2.843ex;" alt="{\displaystyle X(z)}" loading="lazy"></span>, the output <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle Y(z)}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>Y</mi>
<mo stretchy="false">(</mo>
<mi>z</mi>
<mo stretchy="false">)</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle Y(z)}</annotation>
</semantics>
</math></span><img src="./1529e80a525ae5701df402042a02b40f0bd7d1a4.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:4.671ex; height:2.843ex;" alt="{\displaystyle Y(z)}" loading="lazy"></span> of the delta-sigma modulator's operation is represented by
</p>
<dl><dd><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle Y(z)=X(z)+E(z)\left(1-z^{-1}\right),}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>Y</mi>
<mo stretchy="false">(</mo>
<mi>z</mi>
<mo stretchy="false">)</mo>
<mo>=</mo>
<mi>X</mi>
<mo stretchy="false">(</mo>
<mi>z</mi>
<mo stretchy="false">)</mo>
<mo>+</mo>
<mi>E</mi>
<mo stretchy="false">(</mo>
<mi>z</mi>
<mo stretchy="false">)</mo>
<mrow>
<mo>(</mo>
<mrow>
<mn>1</mn>
<mo>−<!-- − --></mo>
<msup>
<mi>z</mi>
<mrow class="MJX-TeXAtom-ORD">
<mo>−<!-- − --></mo>
<mn>1</mn>
</mrow>
</msup>
</mrow>
<mo>)</mo>
</mrow>
<mo>,</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle Y(z)=X(z)+E(z)\left(1-z^{-1}\right),}</annotation>
</semantics>
</math></span><img src="./79175a02b66cfcc9834a018d9d84516caed6d3e3.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.005ex; width:31.137ex; height:3.343ex;" alt="{\displaystyle Y(z)=X(z)+E(z)\left(1-z^{-1}\right),}" loading="lazy"></span></dd></dl>
<p>where <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle E(z)}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>E</mi>
<mo stretchy="false">(</mo>
<mi>z</mi>
<mo stretchy="false">)</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle E(z)}</annotation>
</semantics>
</math></span><img src="./ebc50770cff6e681571069b709c359924fc86f40.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:4.673ex; height:2.843ex;" alt="{\displaystyle E(z)}" loading="lazy"></span> is the frequency-domain <a href="Quantization_error" class="mw-redirect" title="Quantization error">quantization error</a> of the delta-sigma modulator.
Rearranging terms, we obtain
</p>
<dl><dd><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle Y(z)=E(z)+\left[X(z)-Y(z)z^{-1}\right]\left({\frac {1}{1-z^{-1}}}\right).}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>Y</mi>
<mo stretchy="false">(</mo>
<mi>z</mi>
<mo stretchy="false">)</mo>
<mo>=</mo>
<mi>E</mi>
<mo stretchy="false">(</mo>
<mi>z</mi>
<mo stretchy="false">)</mo>
<mo>+</mo>
<mrow>
<mo>[</mo>
<mrow>
<mi>X</mi>
<mo stretchy="false">(</mo>
<mi>z</mi>
<mo stretchy="false">)</mo>
<mo>−<!-- − --></mo>
<mi>Y</mi>
<mo stretchy="false">(</mo>
<mi>z</mi>
<mo stretchy="false">)</mo>
<msup>
<mi>z</mi>
<mrow class="MJX-TeXAtom-ORD">
<mo>−<!-- − --></mo>
<mn>1</mn>
</mrow>
</msup>
</mrow>
<mo>]</mo>
</mrow>
<mrow>
<mo>(</mo>
<mrow class="MJX-TeXAtom-ORD">
<mfrac>
<mn>1</mn>
<mrow>
<mn>1</mn>
<mo>−<!-- − --></mo>
<msup>
<mi>z</mi>
<mrow class="MJX-TeXAtom-ORD">
<mo>−<!-- − --></mo>
<mn>1</mn>
</mrow>
</msup>
</mrow>
</mfrac>
</mrow>
<mo>)</mo>
</mrow>
<mo>.</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle Y(z)=E(z)+\left[X(z)-Y(z)z^{-1}\right]\left({\frac {1}{1-z^{-1}}}\right).}</annotation>
</semantics>
</math></span><img src="./6dbd0060a6fb18a273c3ceccc9efc396b81dacb3.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -2.505ex; width:46.138ex; height:6.176ex;" alt="{\displaystyle Y(z)=E(z)+\left[X(z)-Y(z)z^{-1}\right]\left({\frac {1}{1-z^{-1}}}\right).}" loading="lazy"></span></dd></dl>
<p>The factor <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle 1-z^{-1}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mn>1</mn>
<mo>−<!-- − --></mo>
<msup>
<mi>z</mi>
<mrow class="MJX-TeXAtom-ORD">
<mo>−<!-- − --></mo>
<mn>1</mn>
</mrow>
</msup>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle 1-z^{-1}}</annotation>
</semantics>
</math></span><img src="./2bdda86d34c01b0860ec8fdce0e81d6e56ea5e56.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.505ex; width:7.426ex; height:2.843ex;" alt="{\displaystyle 1-z^{-1}}" loading="lazy"></span> represents a <a href="High-pass_filter" title="High-pass filter">high-pass filter</a>, so it is clear that <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle E(z)}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>E</mi>
<mo stretchy="false">(</mo>
<mi>z</mi>
<mo stretchy="false">)</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle E(z)}</annotation>
</semantics>
</math></span><img src="./ebc50770cff6e681571069b709c359924fc86f40.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:4.673ex; height:2.843ex;" alt="{\displaystyle E(z)}" loading="lazy"></span> contributes less to the output <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle Y(z)}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>Y</mi>
<mo stretchy="false">(</mo>
<mi>z</mi>
<mo stretchy="false">)</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle Y(z)}</annotation>
</semantics>
</math></span><img src="./1529e80a525ae5701df402042a02b40f0bd7d1a4.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:4.671ex; height:2.843ex;" alt="{\displaystyle Y(z)}" loading="lazy"></span> at low frequencies and more at high frequencies. This demonstrates the <a href="Noise_shaping" title="Noise shaping">noise shaping</a> effect of the delta-sigma modulator: the quantization noise is "pushed" out of the low frequencies up into the high-frequency range.
</p><p>Using the inverse <a href="Z-transform" title="Z-transform">Z-transform</a>, we may convert this into a <a href="Difference_equation" class="mw-redirect" title="Difference equation">difference equation</a> relating the input of the delta-sigma modulator to its output in the <a href="Discrete_time" class="mw-redirect" title="Discrete time">discrete time</a> domain,
</p>
<dl><dd><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle y[n]=x[n]+e[n]-e[n-1].}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>y</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo stretchy="false">]</mo>
<mo>=</mo>
<mi>x</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo stretchy="false">]</mo>
<mo>+</mo>
<mi>e</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo stretchy="false">]</mo>
<mo>−<!-- − --></mo>
<mi>e</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo>−<!-- − --></mo>
<mn>1</mn>
<mo stretchy="false">]</mo>
<mo>.</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle y[n]=x[n]+e[n]-e[n-1].}</annotation>
</semantics>
</math></span><img src="./3626b33d135683c62a3814f68db2f42bda555e72.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:28.835ex; height:2.843ex;" alt="{\displaystyle y[n]=x[n]+e[n]-e[n-1].}" loading="lazy"></span></dd></dl>
<p>There are two additional constraints to consider: first, at each step the output sample <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle y[n]}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>y</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo stretchy="false">]</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle y[n]}</annotation>
</semantics>
</math></span><img src="./305428e6d1fb59cd0163a7a96ace52292a262afa.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:3.844ex; height:2.843ex;" alt="{\displaystyle y[n]}" loading="lazy"></span> is chosen so as to <i>minimize</i> the "running" quantization error <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle e[n].}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>e</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo stretchy="false">]</mo>
<mo>.</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle e[n].}</annotation>
</semantics>
</math></span><img src="./81f562ea7c52196b0ccc7bb918f1eede7b0d6889.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:4.419ex; height:2.843ex;" alt="{\displaystyle e[n].}" loading="lazy"></span> Second, <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle y[n]}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>y</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo stretchy="false">]</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle y[n]}</annotation>
</semantics>
</math></span><img src="./305428e6d1fb59cd0163a7a96ace52292a262afa.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:3.844ex; height:2.843ex;" alt="{\displaystyle y[n]}" loading="lazy"></span> is represented as a single bit, meaning it can take on only two values. We choose <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle y[n]=\pm 1}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>y</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo stretchy="false">]</mo>
<mo>=</mo>
<mo>±<!-- ± --></mo>
<mn>1</mn>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle y[n]=\pm 1}</annotation>
</semantics>
</math></span><img src="./52ce163ec18b4dcf10bd31d2be0bade273fb179a.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:9.913ex; height:2.843ex;" alt="{\displaystyle y[n]=\pm 1}" loading="lazy"></span> for convenience, allowing us to write
</p>
<dl><dd><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle {\begin{aligned}y[n]&=\operatorname {sgn} {\big (}x[n]-e[n-1]{\big )}\\&={\begin{cases}+1&x[n]>e[n-1]\\-1&x[n]<e[n-1]\end{cases}}\\&=(x[n]-e[n-1])+e[n].\\\end{aligned}}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mrow class="MJX-TeXAtom-ORD">
<mtable columnalign="right left right left right left right left right left right left" rowspacing="3pt" columnspacing="0em 2em 0em 2em 0em 2em 0em 2em 0em 2em 0em" displaystyle="true">
<mtr>
<mtd>
<mi>y</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo stretchy="false">]</mo>
</mtd>
<mtd>
<mi></mi>
<mo>=</mo>
<mi>sgn</mi>
<mo><!-- --></mo>
<mrow class="MJX-TeXAtom-ORD">
<mrow class="MJX-TeXAtom-ORD">
<mo maxsize="1.2em" minsize="1.2em">(</mo>
</mrow>
</mrow>
<mi>x</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo stretchy="false">]</mo>
<mo>−<!-- − --></mo>
<mi>e</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo>−<!-- − --></mo>
<mn>1</mn>
<mo stretchy="false">]</mo>
<mrow class="MJX-TeXAtom-ORD">
<mrow class="MJX-TeXAtom-ORD">
<mo maxsize="1.2em" minsize="1.2em">)</mo>
</mrow>
</mrow>
</mtd>
</mtr>
<mtr>
<mtd></mtd>
<mtd>
<mi></mi>
<mo>=</mo>
<mrow class="MJX-TeXAtom-ORD">
<mrow>
<mo>{</mo>
<mtable columnalign="left left" rowspacing=".2em" columnspacing="1em" displaystyle="false">
<mtr>
<mtd>
<mo>+</mo>
<mn>1</mn>
</mtd>
<mtd>
<mi>x</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo stretchy="false">]</mo>
<mo>></mo>
<mi>e</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo>−<!-- − --></mo>
<mn>1</mn>
<mo stretchy="false">]</mo>
</mtd>
</mtr>
<mtr>
<mtd>
<mo>−<!-- − --></mo>
<mn>1</mn>
</mtd>
<mtd>
<mi>x</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo stretchy="false">]</mo>
<mo><</mo>
<mi>e</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo>−<!-- − --></mo>
<mn>1</mn>
<mo stretchy="false">]</mo>
</mtd>
</mtr>
</mtable>
<mo fence="true" stretchy="true" symmetric="true"></mo>
</mrow>
</mrow>
</mtd>
</mtr>
<mtr>
<mtd></mtd>
<mtd>
<mi></mi>
<mo>=</mo>
<mo stretchy="false">(</mo>
<mi>x</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo stretchy="false">]</mo>
<mo>−<!-- − --></mo>
<mi>e</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo>−<!-- − --></mo>
<mn>1</mn>
<mo stretchy="false">]</mo>
<mo stretchy="false">)</mo>
<mo>+</mo>
<mi>e</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo stretchy="false">]</mo>
<mo>.</mo>
</mtd>
</mtr>
</mtable>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle {\begin{aligned}y[n]&=\operatorname {sgn} {\big (}x[n]-e[n-1]{\big )}\\&={\begin{cases}+1&x[n]>e[n-1]\\-1&x[n]<e[n-1]\end{cases}}\\&=(x[n]-e[n-1])+e[n].\\\end{aligned}}}</annotation>
</semantics>
</math></span><img src="./00c57d9d8ca2f06013fda943cffe95d09d336c75.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -5.838ex; width:31.395ex; height:12.843ex;" alt="{\displaystyle {\begin{aligned}y[n]&=\operatorname {sgn} {\big (}x[n]-e[n-1]{\big )}\\&={\begin{cases}+1&x[n]>e[n-1]\\-1&x[n]<e[n-1]\end{cases}}\\&=(x[n]-e[n-1])+e[n].\\\end{aligned}}}" loading="lazy"></span></dd></dl>
<p>Rearranging to solve for <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle e[n]}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>e</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo stretchy="false">]</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle e[n]}</annotation>
</semantics>
</math></span><img src="./9333d516ef86093cecb2ccbbc8097e5136758c0d.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:3.772ex; height:2.843ex;" alt="{\displaystyle e[n]}" loading="lazy"></span> yields:
</p>
<dl><dd><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle e[n]=y[n]-{\big (}x[n]-e[n-1]{\big )}=\operatorname {sgn} {\big (}x[n]-e[n-1]{\big )}-{\big (}x[n]-e[n-1]{\big )}.}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>e</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo stretchy="false">]</mo>
<mo>=</mo>
<mi>y</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo stretchy="false">]</mo>
<mo>−<!-- − --></mo>
<mrow class="MJX-TeXAtom-ORD">
<mrow class="MJX-TeXAtom-ORD">
<mo maxsize="1.2em" minsize="1.2em">(</mo>
</mrow>
</mrow>
<mi>x</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo stretchy="false">]</mo>
<mo>−<!-- − --></mo>
<mi>e</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo>−<!-- − --></mo>
<mn>1</mn>
<mo stretchy="false">]</mo>
<mrow class="MJX-TeXAtom-ORD">
<mrow class="MJX-TeXAtom-ORD">
<mo maxsize="1.2em" minsize="1.2em">)</mo>
</mrow>
</mrow>
<mo>=</mo>
<mi>sgn</mi>
<mo><!-- --></mo>
<mrow class="MJX-TeXAtom-ORD">
<mrow class="MJX-TeXAtom-ORD">
<mo maxsize="1.2em" minsize="1.2em">(</mo>
</mrow>
</mrow>
<mi>x</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo stretchy="false">]</mo>
<mo>−<!-- − --></mo>
<mi>e</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo>−<!-- − --></mo>
<mn>1</mn>
<mo stretchy="false">]</mo>
<mrow class="MJX-TeXAtom-ORD">
<mrow class="MJX-TeXAtom-ORD">
<mo maxsize="1.2em" minsize="1.2em">)</mo>
</mrow>
</mrow>
<mo>−<!-- − --></mo>
<mrow class="MJX-TeXAtom-ORD">
<mrow class="MJX-TeXAtom-ORD">
<mo maxsize="1.2em" minsize="1.2em">(</mo>
</mrow>
</mrow>
<mi>x</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo stretchy="false">]</mo>
<mo>−<!-- − --></mo>
<mi>e</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo>−<!-- − --></mo>
<mn>1</mn>
<mo stretchy="false">]</mo>
<mrow class="MJX-TeXAtom-ORD">
<mrow class="MJX-TeXAtom-ORD">
<mo maxsize="1.2em" minsize="1.2em">)</mo>
</mrow>
</mrow>
<mo>.</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle e[n]=y[n]-{\big (}x[n]-e[n-1]{\big )}=\operatorname {sgn} {\big (}x[n]-e[n-1]{\big )}-{\big (}x[n]-e[n-1]{\big )}.}</annotation>
</semantics>
</math></span><img src="./7d52cf25c49d398cdd9cafca37e66f34727f390b.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -1.005ex; width:74.188ex; height:3.176ex;" alt="{\displaystyle e[n]=y[n]-{\big (}x[n]-e[n-1]{\big )}=\operatorname {sgn} {\big (}x[n]-e[n-1]{\big )}-{\big (}x[n]-e[n-1]{\big )}.}" loading="lazy"></span></dd></dl>
<p>This, finally, gives a formula for the output sample <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle y[n]}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>y</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo stretchy="false">]</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle y[n]}</annotation>
</semantics>
</math></span><img src="./305428e6d1fb59cd0163a7a96ace52292a262afa.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:3.844ex; height:2.843ex;" alt="{\displaystyle y[n]}" loading="lazy"></span> in terms of the input sample <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle x[n]}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>x</mi>
<mo stretchy="false">[</mo>
<mi>n</mi>
<mo stretchy="false">]</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle x[n]}</annotation>
</semantics>
</math></span><img src="./864cbbefbdcb55af4d9390911de1bf70167c4a3d.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:4.018ex; height:2.843ex;" alt="{\displaystyle x[n]}" loading="lazy"></span>. The quantization error of each sample is <a href="Negative_feedback" title="Negative feedback">fed back</a> into the input for the following sample.
</p><p>The following pseudo-code implements this algorithm to convert a <a href="Pulse-code_modulation" title="Pulse-code modulation">pulse-code modulation</a> signal into a PDM signal:
</p>
<pre><i>// Encode samples into pulse-density modulation</i>
<i>// using a first-order sigma-delta modulator</i>
<b>function</b> pdm(<i>real[0..s]</i> x, <i>real</i> qe = 0) <i>// initial running error is zero</i>
<b>var</b> <i>int[0..s]</i> y
<b>for</b> n <b>from</b> 0 <b>to</b> s <b>do</b>
qe := qe + x[n]
<b>if</b> qe > 0 <b>then</b>
y[n] := 1
<b>else</b>
y[n] := −1
qe := qe - y[n]
<b>return</b> y, qe <i>// return output and running error</i>
</pre>
<div class="mw-heading mw-heading2"><h2 id="Applications">Applications</h2></div>
<p>PDM is the encoding used in Sony's <a href="Super_Audio_CD" title="Super Audio CD">Super Audio CD</a> (SACD) format, under the name <a href="Direct_Stream_Digital" title="Direct Stream Digital">Direct Stream Digital</a>.
</p><p>PDM is also the output of some <a href="MEMS" title="MEMS">MEMS</a> <a href="Microphones" class="mw-redirect" title="Microphones">microphones</a>.<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup>
</p><p>Some systems transmit PDM <a href="Stereo_audio" class="mw-redirect" title="Stereo audio">stereo audio</a> over a single data wire. The rising edge of the master clock indicates a bit from the left channel, while the falling edge of the master clock indicates a bit from the right channel.<sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-5" class="reference"><a href="#cite_note-5"><span class="cite-bracket">[</span>5<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-6" class="reference"><a href="#cite_note-6"><span class="cite-bracket">[</span>6<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div>
<ul><li><a href="Delta_modulation" title="Delta modulation">Delta modulation</a></li>
<li><a href="Pulse-code_modulation" title="Pulse-code modulation">Pulse-code modulation</a></li>
<li><a href="Delta-sigma_modulation" title="Delta-sigma modulation">Delta-sigma modulation</a></li></ul>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */
.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}
/* end https://en.wikipedia.org/ */
</style><div class="reflist">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-1">^</a></b></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */
.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}
/* end https://en.wikipedia.org/ */
</style><cite class="citation book cs1"><a rel="nofollow" class="external text" href="https://www.st.com/content/ccc/resource/technical/document/application_note/group0/7d/62/3d/ad/24/57/47/78/DM00380469/files/DM00380469.pdf/jcr:content/translations/en.DM00380469.pdf"><i>Application Note AN5027 (Rev 2): "Interfacing PDM digital microphones using STM32 MCUs and MPUs"</i></a> <span class="cs1-format">(PDF)</span>. <a href="STMicroelectronics" title="STMicroelectronics">STMicroelectronics</a>. July 2019. p. 13<span class="reference-accessdate">. Retrieved <span class="nowrap">30 July</span> 2025</span>.</cite></span>
</li>
<li id="cite_note-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-2">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.ap.com/news/more-about-pdm#content">"More about PDM"</a>. <i>Audio Precision</i>. <a rel="nofollow" class="external text" href="https://web.archive.org/web/20250523132211/https://www.ap.com/news/more-about-pdm#content">Archived</a> from the original on 2025-05-23<span class="reference-accessdate">. Retrieved <span class="nowrap">30 July</span> 2025</span>.</cite></span>
</li>
<li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text"><cite id="CITEREFFried2018" class="citation web cs1"><a href="Limor_Fried" title="Limor Fried">Fried, Limor</a> (2018-01-10). <a rel="nofollow" class="external text" href="https://learn.adafruit.com/adafruit-pdm-microphone-breakout/overview">"Adafruit PDM Microphone Breakout"</a>. <i>Adafruit Learning System</i>. <a rel="nofollow" class="external text" href="https://web.archive.org/web/20221208204922/http://learn.adafruit.com/adafruit-pdm-microphone-breakout/overview">Archived</a> from the original on 2022-12-08<span class="reference-accessdate">. Retrieved <span class="nowrap">2023-06-30</span></span>.</cite></span>
</li>
<li id="cite_note-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-4">^</a></b></span> <span class="reference-text">Thomas Kite. <a rel="nofollow" class="external text" href="http://users.ece.utexas.edu/~bevans/courses/rtdsp/lectures/10_Data_Conversion/AP_Understanding_PDM_Digital_Audio.pdf">"Understanding PDM Digital Audio" (PDF)</a>. 2012. The "PDM Microphones" section on p. 6.</span>
</li>
<li id="cite_note-5"><span class="mw-cite-backlink"><b><a href="#cite_ref-5">^</a></b></span> <span class="reference-text">Maxim Integrated. <a rel="nofollow" class="external text" href="http://datasheets.maximintegrated.com/en/ds/MAX98356.pdf">"PDM Input Class D Audio Power Amplifier" (PDF)</a>. 2013. Figure 1 on p. 5; and the "Digital Audio Interface" section on p. 13.</span>
</li>
<li id="cite_note-6"><span class="mw-cite-backlink"><b><a href="#cite_ref-6">^</a></b></span> <span class="reference-text">Knowles. <a rel="nofollow" class="external text" href="https://www.knowles.com/docs/default-source/model-downloads/spk0641ht4h-1-rev-b.pdf?Status=Master&sfvrsn=20be77b1_4">"SPK0641 Digital, CMOS MEMS Microphone" (PDF)</a>.</span>
</li>
</ol></div></div>
<div class="mw-heading mw-heading2"><h2 id="Further_reading">Further reading</h2></div>
<ul><li><a rel="nofollow" class="external text" href="http://www.cs.tut.fi/sgn/arg/rosti/1-bit/">1-bit A/D and D/A Converters</a> – Discusses <a href="Delta_modulation" title="Delta modulation">delta modulation</a>, PDM (also known as Sigma-delta modulation or SDM), and relationships to <a href="Pulse-code_modulation" title="Pulse-code modulation">Pulse-code modulation</a> (PCM)</li>
<li><cite id="CITEREFKite2012" class="citation web cs1">Kite, Thomas (2012). <a rel="nofollow" class="external text" href="http://users.ece.utexas.edu/~bevans/courses/realtime/lectures/10_Data_Conversion/AP_Understanding_PDM_Digital_Audio.pdf">"Understanding PDM Digital Audio"</a> <span class="cs1-format">(PDF)</span>. Audio Precision<span class="reference-accessdate">. Retrieved <span class="nowrap">19 January</span> 2017</span>.</cite></li></ul></div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2025-07-31" href="https://en.wikipedia.org/wiki/?title=Pulse-density_modulation&oldid=1303574039">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>
</body></html>